package logic_control;

import java.util.Scanner;

public class CommonMeasure {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入第一个数: ");
        int num1 = scanner.nextInt();
        System.out.println("请输入第二个数: ");
        int num2 = scanner.nextInt();
        int common_measure = 0;
        for (int i = num1;i > 0;i--) {
            if (num1 % i == 0 && num2 %i == 0) {
                common_measure = i;
                break;
            }
        }
        System.out.printf("%d和%d的最大公约数为: %d",num1,num2,common_measure);
    }
}
